~ chicken-core (master) /manual/Module (chicken bytevector)
Trap1[[tags: manual]]2[[toc:]]34== Module (chicken bytevector)56This module contains procedures for dealing with "bytevectors",7fixed-size sequences of unsigned 8-bit integers.89=== bytevector1011<procedure>(bytevector FIXNUM ...)</procedure>1213Returns a new bytevector containing the values {{FIXNUM ...}}.1415=== make-bytevector1617<procedure>(make-bytevector SIZE)</procedure>1819Returns a bytevector object of {{SIZE}} bytes, aligned on an 8-byte boundary,20uninitialized.2122=== bytevector?2324<procedure>(bytevector? X)</procedure>2526Returns {{#t}} if {{X}} is a bytevector object, or27{{#f}} otherwise.2829=== bytevector-length3031<procedure>(bytevector-length BYTEVECTOR)</procedure>3233Returns the number of bytes in {{BYTEVECTOR}}.3435=== bytevector-u8-ref3637<procedure>(bytevector-u8-ref BYTEVECTOR INDEX)</procedure>3839Returns the byte at {{INDEX}} in {{BYTEVECTOR}}.4041=== bytevector-u8-set!4243<procedure>(bytevector-u8-set! BYTEVECTOR INDEX VALUE)</procedure>4445Destructively modifies the byte at {{INDEX}} in {{BYTEVECTOR}} to {{VALUE}}, which46should be a fixnum.4748=== utf8->string4950<procedure>(utf8->string BYTEVECTOR [VALIDATE])</procedure>5152Returns a string with the contents of {{BYTEVECTOR}}. if {{VALIDATE}}53is given and false, then invalidly54encoded characters do not signal an error - byte-sequences that do no represent55valid UTF-8 characters are retained and, if extracted with {{string-ref}}56are converted to a trailing surrogate pair half in the range U+DC80 to U+DCFF.5758=== string->utf85960<procedure>(string->utf8 STRING)</procedure>6162Returns a bytevector with the contents of {{STRING}}.6364=== latin1->string6566<procedure>(latin1->string BYTEVECTOR)</procedure>6768Returns a string with the contents of {{BYTEVECTOR}} converted from Latin-1 (ISO-8859-1) encoding to UTF-8.6970=== string->latin17172<procedure>(string->latin1 STRING)</procedure>7374Returns a bytevector with the contents of {{STRING}} encoded as Latin-1 (ISO-?8859-1).7576=== bytevector=?7778<procedure>(bytevector=? BYTEVECTOR1 BYTEVECTOR2)</procedure>7980Returns {{#t}} if the two argument bytevectors are of the same81size and have the same content.8283=== bytevector-append8485<procedure>(bytevector-append BYTEVECTOR ...)</procedure>8687Returns a new bytevector holding the concatenated contents of all88argument bytevectors.8990=== bytevector-copy9192<procedure>(bytevector-copy BYTEVECTOR #!optional START END)</procedure>9394Returns a new bytevector holding the contents of {{BYTEVECTOR}} between95the indices {{START}} to {{END}}.9697=== bytevector-copy!9899<procedure>(bytevector-copy! TO AT FROM #!optional START END)</procedure>100101Copioes the contents of the bytevector FROM between102the indices {{START}} to {{END}} into the bytevector {{TO}}, starting at103index {{AT}}.104105106---107Previous: [[Module (chicken bitwise)]]108109Next: [[Module (chicken condition)]]110111